package com.wangsd.web.coupon.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * 文件管理
 */
@Data
@Entity
@Table(name = "file_management")
@ApiModel(value = "文件管理", description = "文件管理")
public class FileManagement {

    @ApiModelProperty(value = "id")
    /*mybatis plus 自增主键*/
    @TableId(type = IdType.AUTO)
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @ApiModelProperty(value = "（逻辑删除）是否已删；0，未删，1，已删")
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "uid")
    private String uid;

    @ApiModelProperty(value = "name")
    private String name;

    @ApiModelProperty(value = "url")
    private String url;

    @ApiModelProperty(value = "1、公司表轮播图,2、背景图,3、商品图")
    private Integer type;

    @ApiModelProperty(value = "关联主键 （如果type是1，关联company.id, 是2，关联 product.id）")
    private Long masterId;

    @ApiModelProperty(value = "图片跳转url")
    private String transUrl;

    @ApiModelProperty(value = "图片跳转类型: 1,跳转到小程序内部;2,跳转网页（http）;3,跳转小程序")
    @Column(name = "trans_url_type",columnDefinition = "int(11) default 1 not null")
    private Integer transUrlType;

    @TableField(exist = false)
    @Transient
    @ApiModelProperty(value = "文件管理对象list")
    private List<FileManagement> fileManagementList;
}